<template>
	<gui-page>
		<template v-slot:gBody>
			<view class="gui-bg-white gui-dark-bg-level-3 gui-padding">
				<view v-for="(item,index) in items" class="gui-list-items">
					<text class="gui-list-icon gui-icons gui-color-green">&#xe614;</text>
					<view class="gui-list-body gui-border-b">
						<view class="gui-list-title">
							<text class="gui-list-title-text gui-primary-text">{{item.title}}</text>
							<text class="gui-list-title-desc gui-color-gray">{{item.value}}</text>
						</view>
					</view>
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
	import { ref,getCurrentInstance,createApp } from 'vue'
	import guiPage from "@/Grace6/components/gui-page"
	import ybmethod from '../../lib/js/ybmethod';
	import ybgolbal from '../../lib/js/ybgolbal';
	import { onLoad,onPullDownRefresh } from '@dcloudio/uni-app'
	const ybapi = ybgolbal.getybapi(getCurrentInstance());
	const app = createApp();
	let item = ref({});
	let items = ref([]);
	let productid = ref(0);
	
	onLoad((option)=>{
		console.log("进入产品详情页面");
		productid.value = option.productid;
		getData();
	})
	
	onPullDownRefresh(()=>{
		ybmethod.onPullDownRefresh(getData);
	})
	
	function getData(){
		ybapi.Devices_GetProductInfo(productid.value,function(data){
			item.value = data;
			setItems();
		});
	}
	
	function setItems(){
		console.log(item)
		items.value.push({title: "名称", value: item.value.mc});
		items.value.push({title: "产品类型", value: item.value.ptype});
		items.value.push({title: "产品编号", value: item.value.bh});
		items.value.push({title: "产品描述", value: item.value.descption});
		items.value.push({title: "设备数量", value: item.value.devcount});
		items.value.push({title: "网络类型", value: item.value.nettype});
		items.value.push({title: "通信协议", value: item.value.proto});
		items.value.push({title: "最近更新时间", value: item.value.update_time});
		console.log(items)
	}
	
	app.component({
		guiPage
	});
	
</script>

<style>
	       
</style>
